package com.xiyo.walle;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.meituan.android.walle.WalleChannelReader;

import java.util.Map;

public class MainActivity extends AppCompatActivity {

    TextView channal_textview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        channal_textview = findViewById(R.id.channal_textview);

        initChannelInfo();
    }

    private void initChannelInfo() {
        String channelName = WalleChannelReader.getChannel(this.getApplicationContext(), "xxxx");
        String channelNameText = "";
        Map<String, String> channelInfoMap = WalleChannelReader.getChannelInfoMap(this.getApplicationContext());

        if (channelInfoMap != null && channelInfoMap.size() > 0) {
            channelNameText = channelInfoMap.get("name");
        }

        channal_textview.setText(channelName);
        Toast.makeText(this, channelNameText, Toast.LENGTH_SHORT).show();
    }
}
